package com.mz.ozy.adapter;

import android.text.TextUtils;
import android.view.View;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.ReplyBean;
import com.mz.ozy.utils.Utils;

import java.util.List;

/**
 * Created by Administrator on 2019/3/26.
 */

public class ReplyListAdapter extends BaseQuickAdapter<ReplyBean, BaseViewHolder> {

    public ReplyListAdapter(@Nullable List<ReplyBean> data) {
        super(R.layout.item_reply_comments, data);
//        addData(new ReplyBean());
//        addData(new ReplyBean());
//        addData(new ReplyBean());
    }

    @Override
    protected void convert(BaseViewHolder helper, ReplyBean item) {
        helper.setText(R.id.tv_reply_name, item.getUname());
        if (!TextUtils.isEmpty(item.getUuname())) {
            helper.getView(R.id.tv_reply_label).setVisibility(View.VISIBLE);
            helper.getView(R.id.tv_host_name).setVisibility(View.VISIBLE);
            helper.setText(R.id.tv_host_name, item.getUuname());
        } else {
            helper.getView(R.id.tv_reply_label).setVisibility(View.GONE);
            helper.getView(R.id.tv_host_name).setVisibility(View.GONE);
            helper.setText(R.id.tv_host_name, item.getUuname());
        }

        helper.setText(R.id.tv_reply_content, Utils.getDecodeStr(item.getContent()));
        helper.setText(R.id.tv_reply_content, item.getContent());
        helper.addOnClickListener(R.id.tv_reply_name);
        helper.addOnClickListener(R.id.tv_host_name);
        helper.addOnClickListener(R.id.tv_reply_label);
        helper.addOnClickListener(R.id.tv_reply_content);
    }
}